<?php

namespace App\Model;

use App\Tools\Traits\SerializeDateTrait;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\TestRecord
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property int $user_id
 * @property string $sn 设备编号
 * @property string $name 蓝牙ID
 * @property int $step_2 校表
 * @property int $step_3 开闸/合闸
 * @property int $step_4 清表
 * @property string $error_ratio 精度误差
 * @method static \Database\Factories\TestRecordFactory factory(...$parameters)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord query()
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereBlueId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereErrorRatio($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereSn($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereStep2($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereStep3($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereStep4($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereUserId($value)
 * @property int $device_type 设备类型
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereDeviceType($value)
 * @property string $mac mac地址
 * @property string $mobile 用户手机号
 * @property string|null $overload_i 过载电流
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereMac($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereOverloadI($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereUserName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|TestRecord whereUserPhone($value)
 * @mixin \Eloquent
 */
class TestRecord extends Model
{
    use HasFactory, SerializeDateTrait;

    protected $guarded = [];

    protected $casts = [
        'step_2' => 'boolean',
        'step_3' => 'boolean',
        'step_4' => 'boolean',
    ];

    const DEVICE_TYPE_4G = 1;
    const DEVICE_TYPE_BLUETOOTH = 2;
    const DEVICE_TYPE_MAP = [
        self::DEVICE_TYPE_4G => '4G',
        self::DEVICE_TYPE_BLUETOOTH => '蓝牙',
    ];

}
